/**
 * @file    If_nvm.h
 * @brief   驱动接口-存储设备
 * @author  Liuwei
 * @version 1.0.1
 * @date    2023-04-27
 * 
 * @copyright Copyright (c) 2023 JBD-Energy Storage Technology Co. LTD
 * 
 * @par 修改日志:
 * <table>
 * <tr><th>Date       <th>Version   <th>Author   <th>Description
 * <tr><td>2023-04-27 <td>1.0.1     <td>name     <td>首次创建
 * </table>
 */
#ifndef __IF_NVM_H_
#define __IF_NVM_H_

/* file includes -------------------------------------------------------------*/
#include <stdint.h>
/* cplusplus -----------------------------------------------------------------*/
#ifdef __cplusplus
extern "C" {
#endif

/* macro/define/typedef ------------------------------------------------------*/
/** EEPROM 区域地址 0x00~0x20000*/
/** @brief BOOT参数区域 [0~31] */
#define NVM_BOOT_ST_ADDR       (0x00)   /* BOOT 关键参数 */
#define NVM_BOOT_END_ADDR      (0x1F)   
/** @brief 系统参数区域 [0x20 ~ 0x61F]*/
#define NVM_PARAM_CHK_ADDR     (0x20)   /* APP层参数 */
#define NVM_PARAM_ST_ADDR      (0x30)
#define NVM_PARAM_END_ADDR     (0x2F + 0xC00)  /* 1.5K 存储参数*/ 
/** @brief 历史记录区域 [0x5FF ~ 0x0xC950]*/
#define NVM_EVENT_ST_ADDR      (0xC30) /* 历史记录区域*/
#define NVM_EVENT_END_ADDR     (0xC2F + 50000) /* 历史记录区域*/

/** FLASH 区域地址 */
/* variables -----------------------------------------------------------------*/
/*******************************************************************************
 * public API List
 ******************************************************************************/
uint8_t If_nvm_init(void);
uint32_t If_nvm_get_cap(void);
uint8_t If_nvm_save_data(uint32_t addr , uint8_t *data_buf , uint16_t len);
uint8_t If_nvm_read_data(uint32_t addr , uint8_t *data_buf , uint16_t len);

#ifdef __cplusplus
}
#endif

#endif  /* #ifndef __XXX_H_ */
/********** Copyright (c) 2023 JBD-Energy Storage Technology Co. LTD *********/
